package com.example.demo.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

/**
 * Created by liulanhua on 2018/9/25.
 */
@RestController
public class TestController {


    @GetMapping(value="")
    public ModelAndView index(ModelAndView mv) {
        mv.addObject("record", "this is thymeleaf index page");
        mv.setViewName("index");
        return mv;
    }

    @GetMapping(value="/page1")
    public ModelAndView page1(ModelAndView mv, String name) {
        mv.setViewName("page1");
        mv.addObject("name", name);
        return mv;
    }

    @GetMapping(value="/page2")
    public ModelAndView page2(ModelAndView mv, String name) {
        mv.setViewName("page2");
        mv.addObject("name", name);
        return mv;
    }




}
